export const columns = [
  {
    title: '角色编码',
    dataIndex: 'code',
    width: 100,
    key: 'code',
  },
  {
    title: '角色名称',
    dataIndex: 'name',
    width: 100,
    key: 'name',
  },
  {
    title: '描述',
    dataIndex: 'description',
    width: 180,
    key: 'description',
  },
  {
    title: '应用信息',
    dataIndex: 'appName',
    width: 180,
    key: 'appName',
  },
  {
    title: '内置',
    dataIndex: 'isBuiltIn',
    width: 60,
    align: 'center',
    key: 'isBuiltIn',
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
    key: 'status',
  },
  {
    title: '创建时间',
    dataIndex: 'createdTime',
    key: 'createdTime',
    width: 100,
  },
  {
    title: '操作',
    key: 'action',
    width: 100,
    slots: { customRender: 'action' },
  },
];

export const searchFormSchema = [
  {
    field: 'role_name',
    label: '角色名称',
    component: 'Input',
    componentProps: {
      placeholder: '请输入角色名称',
    },
    labelWidth: 65,
    colProps: { span: 8 },
  },
];

export const roleFormSchema = [
  {
    field: 'id',
    label: '角色名称',
    required: true,
    component: 'Input',
    show: false,
  },
  {
    field: 'name',
    label: '角色名称',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入角色名称',
    },
    rules: [
      {
        trigger: 'change',
        required: true,
        message: '请输入角色名称',
      },
      {
        trigger: 'change',
        min: 1,
        message: '至少输入1位字符',
      },
      {
        trigger: 'change',
        max: 32,
        message: '字符数不超过32位',
      },
    ],
  },
  {
    field: 'code',
    label: '角色编码',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入角色编码',
    },
    rules: [
      {
        trigger: 'change',
        required: true,
        message: '请输入角色编码',
      },
      {
        trigger: 'change',
        min: 1,
        message: '至少输入1位字符',
      },
      {
        trigger: 'change',
        max: 32,
        message: '字符数不超过32位',
      },
    ],
  },
  {
    field: 'status',
    label: '状态',
    required: false,
    component: 'Switch',
    componentProps: {
      options: [
        { label: '禁用', value: false },
        { label: '启用', value: true },
      ],
    },
  },
  {
    label: '角色描述',
    field: 'description',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入角色描述',
    },
    rules: [
      {
        trigger: 'change',
        min: 1,
        message: '至少输入1位字符',
      },
      {
        trigger: 'change',
        max: 255,
        message: '字符数不超过255位',
      },
    ],
  },
  {
    label: ' ',
    field: 'menuId',
    slot: 'menu',
    component: 'Input',
    required: true,
  },
];

export type Page = {
  current: number;
  pageSizeOptions: string[];
  total: number;
  pageSize: number;
};
